package com.lagou.zuoye3;



import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

public class TitleFive {
    public static void main(String[] args) {
        //准备一个List集合，key为编号 ，value为牌
        HashMap<Integer,String> hm1 = new HashMap<>();
        //创建一个List集合，存放编号
        ArrayList<Integer> li1 = new ArrayList<>();
        //准备一个13位数的数组
        String[] numbers = {"2","A","K","Q","J","10","9","8","7","6","5","4","3"};
        //准备花色数组
        String[] colors = {"黑桃","红桃","梅花","方片"};
        //定义一个整数变量
        int i1 = 2;
        //遍历数组
        for (String number:numbers){
            for (String huase: colors){
                li1.add(i1);
                hm1.put(i1++,huase + number);
            }
        }
        li1.add(0);
        li1.add(1);
        hm1.put(0,"大王");
        hm1.put(1,"小王");
        System.out.println("hm1 = " +hm1);

        //洗牌
        Collections.shuffle(li1);
        System.out.println("洗牌后：" + li1);

        //发牌  发给刘备 关羽 张飞 还有底牌
        ArrayList<Integer> liubei = new ArrayList<>();
        ArrayList<Integer> guanyu = new ArrayList<>();
        ArrayList<Integer> zhangfei = new ArrayList<>();
        ArrayList<Integer> dipai = new ArrayList<>();
        //发牌采用集合索引%3
        for (int i = 0; i < li1.size(); i++){
            if (i < 3) {
                dipai.add(li1.get(i));
            } else if (i % 3 == 0) {
                liubei.add(li1.get(i));
            } else if (i % 3 == 1) {
                guanyu.add(li1.get(i));
            } else{
                zhangfei.add(li1.get(i));
            }
        }

        System.out.println("--------------------------");
        //进行编号排序
        System.out.println("发牌结果：");

    }
}
